//
//  LSZIndustryDetailsViewController.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/10/27.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZIndustryDetailsViewController.h"

@interface LSZIndustryDetailsViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong) UITableView * tableViewIndustryDetails;

@end

@implementation LSZIndustryDetailsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"详情";
    [self.tableViewIndustryDetails registerClass:[LSZIndustryDetailsTableViewCell class] forCellReuseIdentifier:@"LSZIndustryDetailsTableViewCell"];
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row < 3) {
        return 35;
    }else{
        CGFloat height = [LSZSpecialPackaging getHeightOfText:ScreenWidth-20 height:ScreenHeight *10 font:14 :[NSString stringWithFormat:@"产业介绍: %@",self.industryMg.content]];
        return height;
    }
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    LSZIndustryDetailsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LSZIndustryDetailsTableViewCell" forIndexPath:indexPath];
    if (indexPath.row == 0) {
        cell.labelTitle.numberOfLines = 1;
        cell.labelTitle.text = [NSString stringWithFormat:@"项目名称: %@",self.industryMg.subject];
    }else if (indexPath.row == 1){
        cell.labelTitle.numberOfLines = 1;
        cell.labelTitle.text = [NSString stringWithFormat:@"开始时间: %@",self.industryMg.publishTime];
    }
    else if (indexPath.row == 2){
        cell.labelTitle.numberOfLines = 1;
        cell.labelTitle.text = [NSString stringWithFormat:@"负责人: %@",self.industryMg.personNames];
    }else{
        CGFloat height = [LSZSpecialPackaging getHeightOfText:ScreenWidth-20 height:ScreenHeight *10 font:14 :[NSString stringWithFormat:@"产业介绍: %@",self.industryMg.content]];

        CGRect rect = cell.labelTitle.frame;
//        rect.origin.y = cell.frame.size.height-0.3;
        rect.size.height = height;
        cell.labelTitle.frame = rect;
        cell.labelTitle.text = [NSString stringWithFormat:@"产业介绍: %@",self.industryMg.content];
        cell.labelTitle.numberOfLines = 0;
    }
    cell.industryMg = self.industryMg;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
-(UITableView *)tableViewIndustryDetails
{
    if (_tableViewIndustryDetails == nil) {
        _tableViewIndustryDetails = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width , [[UIScreen mainScreen] bounds].size.height) style:UITableViewStylePlain];
        _tableViewIndustryDetails.delegate = self;
        _tableViewIndustryDetails.dataSource = self;
        _tableViewIndustryDetails.estimatedRowHeight=0;
        _tableViewIndustryDetails.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableViewIndustryDetails.estimatedSectionFooterHeight =0;
        _tableViewIndustryDetails.estimatedSectionHeaderHeight =0;
        [_tableViewIndustryDetails setSeparatorInset:UIEdgeInsetsMake(0, 20, 0, 20)];
        [self.view addSubview:_tableViewIndustryDetails];
    }
    return _tableViewIndustryDetails;
}


@end
